﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;

namespace CommonHelper
{
    public class CommonMethod
    {
        public static string GetAddress()
        {
             var addressList = Dns.GetHostEntry(Dns.GetHostName()).AddressList;
            if (addressList.Count() > 0)
            {
                return addressList[0].ToString();
            }

            return "localhost";
        }

        /// <summary>
        /// 检查字符串是否合法
        /// </summary>
        /// <param name="parameterString"></param>
        /// <returns></returns>
        public static bool checkString(params string[] parameterString)
        {
            foreach (var parameterStr in parameterString)
            {
                if (string.IsNullOrEmpty(parameterStr))
                {
                    return false;
                }
            }

            return true;
        }
    }
}
